﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>首页</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Le styles -->
    <link href="./css/bootstrap.min.css" rel="stylesheet">
    <style type="text/css">
        body
        {
            padding-top: 60px;
            padding-bottom: 40px;
        }
        .sidebar-nav
        {
            padding: 9px 0;
        }
        
        @media (max-width: 980px)
        {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right
            {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
    </style>
    <link href="./css/bootstrap-responsive.min.css" rel="stylesheet">
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="//cdnjs.bootcss.com/ajax/libs/html5shiv/3.6.2/html5shiv.js"></script>
    <![endif]-->
    <!-- Fav and touch icons -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
    <link rel="shortcut icon" href="../assets/ico/favicon.png">
</head>
<body>
    <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="navbar-inner">
            <div class="container-fluid">
                <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                    <span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar">
                    </span>
                </button>
                <a class="brand" href="#">学生成绩管理系统</a>
                <div class="nav-collapse collapse">
                    <p class="navbar-text pull-right">
                        Logged in as <a class="Lable_username" href="#" class="navbar-link">Username</a>
                    </p>
                    <ul class="nav" id="mainMenu">
                    </ul>
                </div>
                <!--/.nav-collapse -->
            </div>
        </div>
    </div>
    <div class="container-fluid">
        <div id="main" class="row-fluid">
            <div id="main-left" class="span3 bs-docs-sidebar">
                <div class="well sidebar-nav bs-docs-sidenav">
                    <ul class="nav nav-list">
                        <li class="nav-header" id="sideTitle">首页</li>
                        <li class="active"><a href="#stdInfo">学生首页信息</a></li>
                        <li><a href="#techInfo">教师首页信息</a></li>
                    </ul>
                </div>
                <!--/.well -->
            </div>
            <!--/span-->
            <div id="main-right" class="span9">
                <section id="stdInfo">
                <div id="selfSearch-unit" class="hero-unit">
                  <div id="Div1" class="">
                        <legend class="">学生首页信息</legend>
                    </div>
                   
                     <table id="infoTable_std" class="table table-hover">
                     <thead>
                        <th>课程名</th><th>上课时间</th><th>上课长度</th><th>上课地点</th>
                     </thead>
                     <tbody>
                     </tbody>
                    </table>
                </div>
                </section>
                <section id="techInfo"><div id="singleSearch-unit" class="hero-unit">
                 <div id="Div2" class="">
                        <legend class="">教师首页信息</legend>
                    </div>
                    
                    <table id="infoTable_tech" class="table table-hover">
                    <thead>
                        <th>课程名</th><th>上课时间</th><th>上课长度</th><th>上课地点</th>
                     </thead>
                    <tbody>
                    </tbody>
                    </table>
                </div></section>
            </div>
            <!--/span-->
        </div>
        <!--/row-->
        <hr>
    </div>
    <!--/.fluid-container-->
    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="./js/jquery.js"></script>
    <script src="./js/bootstrap.min.js"></script>
    <script src="js/mainMenu.js" type="text/javascript"></script>
    <script src="js/messenger.js" type="text/javascript"></script>
    <link href="css/messenger.css" rel="stylesheet" type="text/css" />
    <link href="css/messenger-theme-future.css" rel="stylesheet" type="text/css" />
    <script>
        //根据学生和学期显示课程信息
        var stdid = "1007433028";
        var params = {
            'action': 'getCoursesByStdTerm',
            'stdid': stdid,
            'term': getCurrentYearTerm()
        };
        $.post("./handler/IndexHandler.ashx", params, function (data, status) {
            var table = $("#infoTable_std tbody");
            table.html("");
            var column = ['coursename', 'lessentime', 'timelength', 'place'];
            var content = "";
            $(data.Table).each(function (i, item) {
                content = "<tr>";
                $(column).each(function (i2, item2) {
                    content += getColumByIdItem(item2, item);
                });
                content += "<td><button class='btn btn-success'>查询成绩<button></td>";
                content += "<td><button class='btn btn-success'>查询考试<button></td>";
                content += "</tr>";
                table.append(content);
            });
        }, 'json');
    </script>
    <script>
        //根据教师和学期显示课程信息
        var techid = "1";
        var params = {
            'action': 'getCoursesByTechTerm',
            'techid': techid,
            'term': getCurrentYearTerm()
        };
        $.post("./handler/IndexHandler.ashx", params, function (data, status) {
            var table = $("#infoTable_tech tbody");
            table.html("");
            var column = ['coursename', 'lessentime', 'timelength', 'place'];
            var content = "";
            $(data.Table).each(function (i, item) {
                content = "<tr>";
                $(column).each(function (i2, item2) {
                    content += getColumByIdItem(item2, item);
                });
                content += "<td><button class='btn btn-success'>查询成绩<button></td>";
                content += "<td><button class='btn btn-success'>查询考试<button></td>";
                content += "</tr>";
                table.append(content);
            });
        }, 'json');
       
    </script>
    <script>
        //从后台获取选择条件
        var stdid = "1007433028";
        $('#select-term').change(function () {
            getConditByParams(
            { 'action': 'getCourseByTermStd',
                'term': $('#select-term').val(),
                'stdid': stdid
            },
            {
                selectid: "select-course",
                idcolum: "actualcourseid",
                name: "coursename"
            },
              function () { $('#select-course').change() }
              );
        });
        $('#select-course').change(function () {
            getConditByParams(
            { 'action': 'getExzamByCourseid',
                'courseid': $('#select-course').val(), 'stdid': stdid
            },
            { selectid: "select-exzam", idcolum: "exzamid", name: "name" },
            function () { }
            );
        });
        $('#searchbycond').click(function () {
            var courseid = $("#select-course").val();
            var exzamid = $("#select-exzam").val();
            $.post("handler/ScoreHandler.ashx",
            { 'action': 'getScoreByCondit', 'exzamid': exzamid, "stdid": stdid, "courseid": courseid },
            function (data, status) {
                var colums = ['stdid', 'name', 'score'];
                getFullTableRows("searchTable_selfSearch", data, colums);
                $.globalMessenger().post("操作成功");
            },
            "json");
        });
    </script>
    <script>
        //单个学生查询
        $("#b_sSearch").click(function () {
            var params = {
                'action': 'single_singleSearch',
                'stdid': $('#inputStdNum').val()
            };
            $.post("handler/ScoreHandler.ashx", params, function (data, status) {
                var colums = ['stdid', 'name', 'score'];
                getFullTableRows("searchTable", data, colums)
                $.globalMessenger().post("查询成功");
            }, 'json');
        });
    </script>
    <script>
        //根据课程显示成绩
        var techid = "1";
        getFourYearTerm("select-term");
        getFourYearTerm("select-term2");
        $("#button_getSocreByCourse").click(function () {
            var courseid = $("#select-course2").val();
            var params = {
                'action': 'getSocreByCourse',
                'courseid': courseid
            };
            $.post("./handler/ScoreHandler.ashx", params, function (data, status) {
                var colums = ['stdid', 'name', 'score'];
                getFullTableRows("Table_searchByClass", data, colums);
                $.globalMessenger().post("查询成功");
            }, 'json');
        });
        $('#select-term').change();
        $('#select-term2').change(function () {
            getConditByParams(
            { 'action': 'getCourseByTechTerm',
                'term': $('#select-term2').val(),
                'techid': techid
            },
            {
                selectid: "select-course2",
                idcolum: "actualcourseid",
                name: "coursename"
            },
              function () { $('#select-course2').change() }
              );
        });
        $('#select-term2').change();
    </script>
    <script>
        //获取session中的username并显示
      
       
            
    </script>
</body>
</html>
